<template>
  <div>
    <aplid-base-crud ref="crud" class="w-100" v-bind="baseConfig">
      <template v-slot:editDialog="{ row, show }">
      <EditForm
      @refresh="handleRefresh"
      :key="show" 
      :nowRowData="row"
      >
      </EditForm>
      </template>
      <template v-slot:detailDialog="{ row, show }">
      <Detail
      @refresh="handleRefresh"
      :key="show" 
      :nowRowData="row"
      >
      </Detail>
      </template>
      <!-- <template #menuLeftAppend>
        <el-button type="primary" @click="openSelect('report')">导出报告</el-button>
        <el-button type="primary" @click="openSelect('report')">导出为word</el-button>
      </template> -->
    </aplid-base-crud>
  </div>
</template>

<script setup lang="ts">
import FileSaver from 'file-saver'
import EditForm from './components/editForm/index.vue'
import Detail from './components/detail/index.vue'
import {baseConfig} from './config'
import {ref,nextTick} from 'vue'
import axios from 'axios'

let crud = ref()
//  处理刷新
const handleRefresh = (query) => {
  nextTick(() => {
    crud.value.refreshChange(query)
  })
}
// 打开勾选
const openSelect = (type:string) =>{

}
// 去导出
const toOtherExport = async(type:any) => {
  if(type=='excel'){
    axios.get('export/nxjudge/ningxiang/index/report?assess_code=1',{responseType:'blob'}).then(res=>{
      FileSaver.saveAs(res.data, '评估记录报告.zip')
    })
    // await apiMod.view_export_excel()
  }else{
    axios.get('export/nxjudge/ningxiang/index/word?assess_code=1',{responseType:'blob'}).then(res=>{
      FileSaver.saveAs(res.data, '评估记录word.zip')
    })
  }
}
</script>
<style scoped lang="scss">
</style>